package com.beiming.moudle.auth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.beiming.moudle.auth.dao.CategoryDao;
import com.beiming.moudle.auth.entity.CategoryEntity;
import com.beiming.moudle.auth.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity> implements CategoryService
{
    @Autowired
    CategoryDao categoryDao;
    @Override
    public CategoryEntity getCateEntity(int id) {
        return  categoryDao.selectById(id);
    }

    @Override
    public List<CategoryEntity> getCategory(int id) {
        QueryWrapper<CategoryEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("parent_id",id);
        List<CategoryEntity> categoryEntity=  categoryDao.selectList(queryWrapper);
        return categoryEntity;
    }
}
